<template>
  <view class="container">
    <!-- 搜索框 -->
    <view class="search">
      <image src="../../static/icon/search.png" mode="aspectFill" style="width: 40rpx; height: 40rpx; position: absolute; left: 50rpx"></image>
      <input type="text" placeholder="请输入学校名字" class="ipt" />
    </view>
    <!-- navbar导航栏 -->
    <view class="navbar">
      <view :class="{ common: status == index }" style="padding-bottom: 4rpx" v-for="(item, index) in navbarlist" :key="index" @click="status = index">{{ item }}</view>
    </view>
    <!-- 全部订单 -->
    <view class="list" v-if="status == 0">
      <view class="item">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject">初三 | 数学</view>
          <view class="long">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">0.25km</view>
            <view class="jiedan">立即接单</view>
          </view>
        </view>
      </view>

      <view class="item">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject">初三 | 数学</view>
          <view class="long">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">已授课程20/120</view>
            <view style="flex: 1; text-align: right; font-size: 32rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #3553e8">距上课还有 3:00:00</view>
          </view>
        </view>
      </view>

      <view class="item">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject">初三 | 数学</view>
          <view class="long">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">已授课程20/120</view>
            <view style="flex: 1; text-align: right; font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #3553e8">12月12日上课</view>
          </view>
        </view>
      </view>

      <view class="item">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject">初三 | 数学</view>
          <view class="long">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">已授课程20/120</view>
          </view>
        </view>
      </view>
    </view>
    <!-- 待接单、进行中、已结课、 -->
    <view class="list" v-else>
      <view class="item" v-for="index in 5" :key="index" @click="godetail">
        <image src="../../static/img/jiedan.png" mode="aspectFill" style="width: 186rpx; height: 186rpx"></image>
        <view class="right">
          <view class="name">
            <view style="font-size: 30rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #222222">张同学</view>
            <image src="../../static/icon/nan.png" mode="" style="width: 42rpx; height: 42rpx"></image>
            <view class="school">第五实验中学</view>
          </view>
          <view class="subject">初三 | 数学</view>
          <!-- 待接单 -->
          <view class="long" v-if="status == 1">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">0.25km</view>
            <view class="jiedan">立即接单</view>
          </view>
          <!-- 进行中 -->
          <view class="long" v-if="status == 2">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">已授课程20/120</view>
            <view style="flex: 1; text-align: right; font-size: 32rpx; font-family: PingFang SC, PingFang SC; font-weight: bold; color: #3553e8">距上课还有 3:00:00</view>
          </view>
          <!-- 已结课 -->
          <view class="long" v-if="status == 3">
            <view style="font-size: 28rpx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #222222">已授课程20/120</view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      navbarlist: ['全部订单', '待接单', '进行中', '已结课'],
      status: 0
    };
  },
  methods: {
    // 跳转到详情
    godetail() {
      if (this.status == 1) {
        uni.navigateTo({
          url: '/sub_user/waitorderdetail/waitorderdetail'
        });
      } else if (this.status == 2) {
        uni.navigateTo({
          url: '/sub_user/doingdetail/doingdetail'
        });
      } else if (this.status == 3) {
        uni.navigateTo({
          url: '/sub_user/overdetail/overdetail'
        });
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  box-sizing: border-box;
  .search {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100rpx;
    background-color: #3553e8;
    .ipt {
      box-sizing: border-box;
      font-size: 28rpx;
      background: #5d75ed;
      padding-left: 80rpx;
      color: #fff;
      border-radius: 100rpx 100rpx 100rpx 100rpx;
      width: 690rpx;
      height: 64rpx;
    }
  }
  .navbar {
    display: flex;
    justify-content: space-around;
    margin-top: 30rpx;
    font-size: 26rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: 500;
    color: #333333;
    .common {
      font-size: 28rpx;
      font-family: PingFang SC, PingFang SC;
      font-weight: bold;
      color: #3553e8;
      border-bottom: 8rpx solid #3553e8;
    }
  }
  .list {
    box-sizing: border-box;
    margin: 30rpx;
    .item {
      display: flex;
      width: 690rpx;
      height: 186rpx;
      margin-bottom: 40rpx;
      .right {
        flex: 1;
        margin-left: 20rpx;
        .name {
          display: flex;
          .school {
            font-size: 22rpx;
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            width: 172rpx;
            height: 40rpx;
            background: #eaedfd;
            border-radius: 10rpx 10rpx 10rpx 10rpx;
            color: #3553e8;
            text-align: center;
            line-height: 40rpx;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
          }
        }
        .subject {
          font-size: 26rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
        }
        .long {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-top: 18rpx;
          .jiedan {
            box-sizing: border-box;
            width: 160rpx;
            height: 60rpx;
            text-align: center;
            line-height: 60rpx;
            font-size: 28rpx;
            color: #fff;
            background: #3553e8;
            border-radius: 100rpx 100rpx 100rpx 100rpx;
          }
        }
      }
    }
  }
}
</style>
